var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/businessComponent/express/index.tsx
var express_exports = {};
__export(express_exports, {
  openExpressModel: () => openExpressModel
});
module.exports = __toCommonJS(express_exports);
var import_functionalComponent = require("../../functionalComponent");
var import_util = require("../../util");
var import_base = __toESM(require("./base"));
var openExpressModel = (params) => new Promise((resolve) => {
  const {
    bizPoint,
    value,
    definitionRequest,
    definitionVersionRequest,
    dataModelRequest,
    earlyWarningRequest,
    onOk,
    onCancel
  } = params;
  const { height, width } = (0, import_util.getGlobalConfig)().default.helpConfig;
  const configMap = [
    {
      bizPoint: "ruleDefinition",
      type: "definitionRequest",
      params: definitionRequest
    },
    {
      bizPoint: "ruleDefinitionVersion",
      type: "definitionVersionRequest",
      params: definitionVersionRequest
    },
    {
      bizPoint: "dataModelDesign",
      type: "dataModelRequest",
      params: dataModelRequest
    },
    {
      bizPoint: "earlyWarning",
      type: "earlyWarningRequest",
      params: earlyWarningRequest
    }
  ];
  const config = configMap.find((v) => v.bizPoint === bizPoint);
  (0, import_functionalComponent.showModal)({
    title: "表达式",
    height,
    width,
    contentStyle: { padding: "0px 16px" },
    content: /* @__PURE__ */ React.createElement(
      import_base.default,
      {
        type: {
          type: config == null ? void 0 : config.type,
          // @ts-ignore
          value: {
            [config.type]: config == null ? void 0 : config.params,
            bizPoint
          }
        },
        value
      }
    ),
    async onOk(ins) {
      const { getValue } = ins.getApi();
      const res = await getValue();
      if (!res.validateResult) {
        import_functionalComponent.message.warn(res.validateMsg);
        return;
      }
      const value2 = {
        label: res.expressionDisplay,
        value: res.expressionValue,
        origin: res
      };
      if (onOk)
        onOk(value2);
      resolve(value2);
      ins.destroy();
    },
    onCancel(ins) {
      if (onCancel)
        onCancel();
      resolve(null);
      ins.destroy();
    }
  });
});
import_util.iup.registerExternal({ openExpressModel });
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  openExpressModel
});
